package com.ruoyi.door.service;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.door.domain.proxy.DoorRepairOrderLogProxy;
import com.ruoyi.door.domain.DoorRepairOrderLog;
import com.easy.query.api.proxy.entity.select.EntityQueryable;
import com.easy.query.core.api.pagination.EasyPageResult;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.easy.query.api.proxy.client.EasyEntityQuery;
/**
 * 报修日志Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-29
 */
@Service
public class DoorRepairOrderLogService
{
    @Autowired
    private EasyEntityQuery easyEntityQuery;

    /**
     * 查询报修日志
     *
     * @param id 报修日志主键
     * @return 报修日志
     */
    public DoorRepairOrderLog selectDoorRepairOrderLogById(Long id)
    {
        return easyEntityQuery.queryable(DoorRepairOrderLog.class).where(x -> x.id().eq(id))
                .firstOrNull();
    }

    /**
     * 查询报修日志列表
     *
     * @param repairOrderId 报修日志
     * @return 报修日志
     */
    public List<DoorRepairOrderLog> selectListByRepairOrderId(Long repairOrderId)
    {
        List<DoorRepairOrderLog> pageResult = easyEntityQuery.queryable(DoorRepairOrderLog.class)
                .where(d -> d.repairOrderId().eq(repairOrderId))
                .toList();
        return pageResult;
    }



    /**
     * 新增报修日志
     *
     * @param doorRepairOrderLog 报修日志
     * @return 结果
     */
    public long insertDoorRepairOrderLog(DoorRepairOrderLog doorRepairOrderLog)
    {
        doorRepairOrderLog.setCreateTime(DateUtils.getNowDate());
        return easyEntityQuery.insertable(doorRepairOrderLog).executeRows();
    }

}